/**
 * 
 */
package recognition.output;

import handwritten.character.HandWritten;

/**
 * @author Louis
 *
 */
public class PredictedCharacter implements HandWritten, Comparable<PredictedCharacter> {
	
	private String id;
	private double confidence;
	
	public PredictedCharacter(String id, double confidence){
		this.id = id;
		this.confidence = confidence;
	}

	/* (non-Javadoc)
	 * @see text.character.HandWritten#getId()
	 */
	@Override
	public String getId() {
		return id;
	}
	
	/**
	 * @return the confidence
	 */
	public double getConfidence() {
		return confidence;
	}
	
	public void addConfidence(double strength, double confidence){
		this.confidence += strength*confidence;
	}

	/* (non-Javadoc)
	 * @see java.lang.Comparable#compareTo(java.lang.Object)
	 */
	@Override
	public int compareTo(PredictedCharacter pc) {
		//Invert to get from larger to smaller when sorting 
		return new Double(pc.confidence).compareTo(confidence);
	}
	
	public boolean equals(PredictedCharacter pc){
		return id.equals(pc.id);
	}

	public void normalise(double n)
	{
		confidence = confidence/n;
	}
	
	/* (non-Javadoc)
	 * @see handwritten.character.HandWritten#writeRepresentation()
	 */
	@Override
	public String writeRepresentation() {
			return "";
		
	}

}
